<template>
	<div id="info_tab" >
		<!-- 选项卡 -->
		<div class="user_info_tab">
			<div class="user_info_tab_title">
				<div class="user_info_tab_title_div">
					<img src="../../../../../static/img/luxun.jpg" class="user_info_tab_title_head" />
				</div>
				<div class="user_info_tab_title_div">
					<span class="user_info_tab_title_name">鲁迅</span>
				</div>
				<div class="user_info_tab_tabs active" @click="myInfoData">
					<img src="../../../../../static/img/info_data_user1.png" class="icon" align="center" />&nbsp;我的资料
				</div>
				<div class="user_info_tab_tabs" @click="myComment">
					<img src="../../../../../static/img/info_data_user2.png" class="icon" align="center" />&nbsp;我的评论
				</div>
			</div>
		</div>
	</div>
</template>

<script type="application/ecmascript-6">
 export default{
 	name:'home_info',
 	data(){
 		return{
 			token:'',
 			userInfo:{},
 			active:true
 		};
 	},
 	created(){
		var tokenData = localStorage.getItem("token");
		var jsonO = JSON.parse(tokenData);
		if(!jsonO){
			this.$notify({ message:'请先登录' });
			this.$router.push('/home');
			return;
		}
		this.token = jsonO.token;
		//调用接口查询
		this.$http.get('/api/personalCenter/find',{
			headers:{
				token:this.token
			}
        }).then(response => {
			if(response.body.code==1){
				this.$notify({message:response.body.msg});
				this.$router.push("/home");
				return;
			}
			this.userInfo = response.body.data;
        },error => {
        	if(error.status==401){
        		this.$notify({message:"请先登录"});
				this.$router.push("/home");
				return;
        	}
			this.$notify({message:"程序异常："+JSON.stringify(error.status)+"，请联系管理员"});
			this.$route.push('/home');
        });
		this.$router.push("/home/info/mydata");
	},
	methods:{
		myInfoData:function(){
			this.$router.push("/home/info/mydata");
		},
		myComment:function(){
			const h = this.$createElement;
			this.$notify({
				title: '业务暂未开通',
				message:h('i', { style: 'color: teal'},'该功能暂未开通,敬请期待')
			});
			//this.$router.push("/home/info/userInfo");
		}
	}
 };
</script>

<style lang="stylus" rel="stylesgeet/stylus" >
.user_info_tab
	height:100vh
	background-color:#fff
.user_info_tab_title_div:nth-child(2)
	padding-left:10px
	padding-right:10px
.user_info_tab_title_div
	width:auto
	height:80px
	text-align: center
	.user_info_tab_title_head
		margin-top:20px
		width:60px
		height:60px
		border-radius:60px
	.user_info_tab_title_name
		display:block
		padding-top:10px
		font-size:14px
.user_info_tab_tabs
	height:40px
	line-height:40px
	text-align: left
	padding-left:30px
.user_info_tab_tabs:hover
	cursor:pointer
.icon
	width:15px;
	height:15px;
</style>